﻿<UserControl x:Class="SR.ExpressionEvaluator.Lib.ExpressionTextBox"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock x:Name="txtEditorView" Grid.Row="0" Margin="0,0,0,0" TextWrapping="NoWrap" 
			FontFamily="{Binding Font}" FontSize="{Binding FontSize}" Padding="2.5"
            HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        <TextBox x:Name="txtEditorSource" Grid.Row="0" Margin="0,0,0,0" TextWrapping="NoWrap"
			ScrollViewer.VerticalScrollBarVisibility="Visible" 
            Text="{Binding Text, Mode=TwoWay}"
            Foreground="Transparent" Background="Transparent" 
            SelectionForeground="Transparent" BorderBrush="Transparent"
            SelectionBackground="#88CCCCCC" Padding="0"
            HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
            AcceptsReturn="{Binding IsMultiLine}" FontFamily="{Binding Font}" FontSize="{Binding FontSize}" />
        <Popup Height="Auto" HorizontalAlignment="Stretch" IsOpen="True" Grid.Row="1" >
            <!--Visibility="{Binding ElementName=lstProbables, Path=ItemsSource, Converter={StaticResource nullToVisibilityConverter}}"-->
            <Border BorderThickness="0" BorderBrush="Gray">
                <ListBox x:Name="lstProbables" BorderBrush="Transparent" BorderThickness="0"
                    HorizontalAlignment="Left" HorizontalContentAlignment="Left" VerticalAlignment="Top">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Key}" Foreground="Black" FontFamily="{Binding Font}" FontSize="10" />
                                <TextBlock Text="{Binding Value}" Margin="5,0,0,0" FontFamily="{Binding Font}" FontSize="10" Foreground="Gray" />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>
        </Popup>
    </Grid>
</UserControl>
